weight = input("请输入带有符号的重量,")
if weight[-1] in ["g","G"]:
   t=eval(weight[0:-2])/1000
   print(str(t)+"kg")
else:
   print("输入格式错误")
